package com.liangzhong.modules.bag.command
{
	import com.liangzhong.constants.ApplicationConstants;
	import com.liangzhong.model.goods.vo.GoodsVo;
	import com.liangzhong.proxy.bag.BagProxy;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 *背包 
	 * @author lake
	 * 
	 */	
	public class BagCommand extends SimpleCommand
	{
		public function BagCommand()
		{
			super();
		}
		override public function execute(notification:INotification):void
		{
			var proxy :BagProxy = facade.retrieveProxy(BagProxy.PROXYNAME) as BagProxy;
			var goods :GoodsVo;
			switch(notification.getName())
			{
				case ApplicationConstants.BAG_GET_BAG_INFO://获取背包基本信息
				{
					proxy.getBagBaseInfo();
					break;
				}
				case ApplicationConstants.BAG_GRADE_UP://升级
				{
					proxy.gradeUp();
					break;
				}
				case ApplicationConstants.BAG_OPEN_CELLS://开格子
				{
					proxy.openCell();
					break;
				}
				case ApplicationConstants.BAG_USE_ITEM://使用物品
				{
					goods = notification.getBody() as GoodsVo;
					proxy.useItem(goods.pid);
					break;
				}
				case ApplicationConstants.BAG_RESOLVE_ITEM://分解物品
				{
					goods = notification.getBody() as GoodsVo;
					proxy.resolveItem(goods.pid);
					break;
				}
			}
		}
	}
}